package algotithm.acwing.test758;

import java.util.Scanner;

/**
 * @author zhouyanxiang
 * @Date 2020-12-2020/12/31-22:20
 */
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < nums.length; i++) {
            nums[i] = scanner.nextInt();
        }
        scanner.close();
        Main main = new Main();
        main.quickSort(nums,0,nums.length-1);
        for (int num : nums) {
            System.out.print(num + " ");
        }
    }

    public  void quickSort(int[] nums,int low,int high) {
        if (low > high) {
            return;
        }
        int i = low, j = high;
        int pivot = nums[low];
        while (i < j) {
            while (i < j && nums[j] >= pivot) {
                j--;
            }
            while (i < j && nums[i] <= pivot) {
                i++;
            }
            if (i < j) {
                swap(nums,i,j);
            }
        }
        nums[low] = nums[i];
        nums[i] = pivot;
        quickSort(nums,low,j-1);
        quickSort(nums,j+1,high);
    }


    public static void swap(int[] nums, int i,int j) {
        int tmp = nums[i];
        nums[i] = nums[j];
        nums[j] = tmp;
    }

}
